<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'table-cell-content',
  inject: ['slots'],
  props: {
    name: {
      type: String,
      required: true,
    },
    col: {
      type: Object,
      required: true
    },
    row: {
      type: Object,
      required: true
    }
  },
  render() {
    const slots = this.slots as any;
    const { name, col, row } = this;
    if (slots && slots[name]) {
      const vNode = slots[name]({ row, col });
      return vNode;
    }
    return row[name];
  }
});
</script>